package com.ilikesoup.instant.enums.validation;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
 * 标记需要校验的 EnumCode 属性
 *
 * @author Soup
 */
@Target({ METHOD, FIELD, ANNOTATION_TYPE, CONSTRUCTOR, PARAMETER, TYPE_USE })
@Retention(RUNTIME)
@Documented
@Constraint(validatedBy = EnumCodeConstraintValidator.class)
public @interface EnumCode {
    /**
     * 该枚举类必须实现 {@link com.ilikesoup.instant.enums.basic.CodeEnum}
     */
    Class<? extends Enum<?>> value();

    String message() default "{javax.validation.constraints.EnumCode.message}";

    Class<?>[] groups() default { };

    Class<? extends Payload>[] payload() default { };

}
